package com.qqtech.qquan.sys.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.google.common.base.Splitter;
import com.google.common.collect.Lists;

@SuppressWarnings("serial")
public class SysFunctionQuery extends SysFunction{
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}

	/** 角色id 逗号隔开 */
	private String roleIds;
	
	/** 角色id List */
	private List<Integer> roleIdList;

	public String getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(String roleIds) {
		this.roleIds = roleIds;
	}

	public List<Integer> getRoleIdList() {
		 if (StringUtils.isNotBlank(roleIds)) {
	            Iterator<String> it = Splitter.on(",").trimResults().split(roleIds).iterator();
	            List<Integer> list = new ArrayList<Integer>();
	            while(it.hasNext()) {  
	                list.add(new Integer(it.next()));
	            } 
	            return list;
        } else if (roleIdList != null) {
        	return roleIdList;
        }
	    return Lists.newArrayList();
	}

	public void setRoleIdList(List<Integer> roleIdList) {
		this.roleIdList = roleIdList;
	}
	
	
}